package duxiaoman;

import java.util.Scanner;

/**
 * @author Hang
 * @date 2022/8/31
 * @project AutumnOffer
 * @description
 **/
public class Solution1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] arr = new int[n];
        for(int i=0;i<n;i++){
            arr[i] = sc.nextInt();
        }
        int sum = 0;
        sum += sol(arr,0,k);
        System.out.println(sum);
    }
    public static int sol(int[] arr ,int ind,int k){
        int count = 0;
        for(int i=ind;i<arr.length;i++){
            int max = arr[i],min = arr[i];
            for(int j=i;j<arr.length;j++){
                if(arr[j] > max) max = arr[j];
                if(arr[j] < min) min = arr[j];
                if(max == min * k) count++;
            }
        }
        return count;
    }
}
